@model PopUpReviewViewModel

@{
	string twoLettersCulture = new System.Globalization.CultureInfo(Culture).TwoLetterISOLanguageName;	
}

<div class="view-container">
  <!-- Form begin -->
  <div class="entity-form-container">
    @using (Html.BeginForm("", "", FormMethod.Post, new { id = "" })) {
      @Html.ValidationSummary(true)
      <fieldset>
        <legend>@Resources.ReviewResources.Review</legend>
		<div class="form">
          @Html.HiddenFor(model => model.Id)
			<div class="field">
			  <div class="label">
				@Html.Label(Resources.ReviewResources.Date)
			  </div>
			  <div class="editor date-editor">
				@Html.TextBoxFor(model => model.Date)
				@Html.ValidationMessageFor(model => model.Date)
			  </div>
			</div>
			<div class="field">
			  <div class="label">
				@Html.Label(Resources.ReviewResources.Rating)
			  </div>
			  <div class="editor number-editor">
				@Html.EditorFor(model => model.Rating, "Rating")
				@Html.ValidationMessageFor(model => model.Rating)
			  </div>
			</div>
			<div class="field">
			  <div class="label">
				@Html.Label(Resources.ReviewResources.Comment)
			  </div>
			  <div class="editor">
				@Html.TextBoxFor(model => model.Comment)
				@Html.ValidationMessageFor(model => model.Comment)
			  </div>
			</div>
		@if(ViewBag.MasterProperty != null && ViewBag.MasterProperty != "Customer")
		{
			<div class="field">
			  <div class="label">
			    @Html.LabelFor(model => model.CustomerId)
			  </div>
			  <div class="editor">
			    @Html.DropDownListFor(model => model.CustomerId, new SelectList(Model.CustomerList, "Id", "IdentityDescription", Model.CustomerId))           
			    @Html.ValidationMessageFor(model => model.CustomerId)
			  </div>
			</div>
		}
		else
		{
			@Html.HiddenFor(model => model.CustomerId)
		}
		@if(ViewBag.MasterProperty != null && ViewBag.MasterProperty != "Product")
		{
			<div class="field">
			  <div class="label">
			    @Html.LabelFor(model => model.ProductId)
			  </div>
			  <div class="editor">
			    @Html.DropDownListFor(model => model.ProductId, new SelectList(Model.ProductList, "Id", "IdentityDescription", Model.ProductId))           
			    @Html.ValidationMessageFor(model => model.ProductId)
			  </div>
			</div>
		}
		else
		{
			@Html.HiddenFor(model => model.ProductId)
		}
		</div>
      </fieldset>
    }
    </div>
	<!-- Form end -->
</div>
<script type="text/javascript">
function @(ViewBag.Name)LoadScripts(detailName)
{
DefaultAddOrDetailPopUpEventTriggers("@(ViewBag.Name)-dialog");
$(function () {
    $("#" + detailName + "Date").datepicker({
        showOn: "button",
        buttonImage: "@Url.Content("~/Content/Images/calendar.png")",
        buttonImageOnly: true,
		changeMonth: true,
		changeYear: true
    });

	$("#" + detailName + "Date").datepicker("option",
		$.datepicker.regional["@(twoLettersCulture == "en" ? "" : twoLettersCulture)"]);
	$("#" + detailName + "Date").val('@(Model.Date != DateTime.MinValue ? Model.Date.ToShortDateString() : "")');
});				
}
</script>
